#include<iostream>
#include<string>
using namespace std;
void Delete(string &s,char tar);
int main()
{
  string s;
  getline(cin,s);
  cout<<s<<endl;
  int len=s.length();
  cout<<len<<endl;
  char tar;
  cin>>tar;
  Delete(s,tar);
  cout<<s<<endl;
  len=s.length();
  cout<<len<<endl;
  return 0;
}
void Delete(string &s,char tar)
{
  int l=s.length();
  for(int i=0;i<l-1;i++){
    if(s[i]==tar){
      int t=i;
      while(t<l-1){
        s[t]=s[t+1];
        t++;
      }
      l--;
      i--;
    }
  }
  s=s.substr(0,l);
}
